<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="redis" uri="http://www.shopjsp.com/redisTag/functions" %>
<c:set var="basePath" value="${redis:getSysConfig('base_path_back')}"/>
<c:set var="srcPath" value="${redis:getSysConfig('sysFileVisitRoot_back')}"/>
<c:set var="uploadPath" value="${redis:getSysConfig('uploadFileVisitRoot')}"/>
<script type="text/javascript">
    function orderProduct(){
        var selectedRow = $("#tt").bootstrapTable('getSelections');
        if(selectedRow.length==1){
            var ordersNo=selectedRow[0].ordersNo;
            $("#btn_orderProduct").attr("data-target","#view_Order_Products_Modal");
            $.ajax({
                type: "POST",
                dataType: "JSON",
                url: "${basePath}/back/orders/findOrdersProduct.sjson",
                data: {ordersNo:ordersNo},
                success: function(result){
                    var data = JSON.parse(result.data);
                    var productMap = data.productMap;
                    var html="<tr class='titlebg'><td align='center' colspan='7'> 订单号："+ordersNo+"<\/td><\/tr>";
                    html += "<tr><td align='center' width='150px'>图片<\/td><td align='center' width='150px'>商品名称<\/td><td align='center' width='150px'>销售价<\/td><td align='center' width='150px'>运费<\/td>"+
                        "<td align='center' width='150px'>折扣<\/td><td align='center' width='150px'>赠送金币<\/td><\/tr>";
                    for(var i=0;i<productMap.length;i++){
                        var zk = productMap[i].discount;
                        if(zk == null){
                            zk = "无折扣";
                        }else{
                            zk += "折";
                        }
                        var virtualCoinNumber=productMap[i].virtualCoinNumber;
                        var salesPrice=productMap[i].salesPrice;
                        var freightPrice=productMap[i].freightPrice;
                        if(virtualCoinNumber==null || virtualCoinNumber==""){
                            virtualCoinNumber=0;
                        }
                        if(salesPrice==null || salesPrice==""){
                            salesPrice=0;
                        }
                        if(freightPrice==null || freightPrice==""){
                            freightPrice=0;
                        }
                        var index=i+1;
                        html+="<tr><td align='center' width='150px'> <img id='uploadImg_"+index+"' width='80px' height='50px' class='uploadImg' onMouseOver='showListBigImage("+index+",4,4,0,-40)' onMouseOut='showListRebackImage("+index+",1,1)' src='${uploadPath}/"+productMap[i].logoImage+"' onerror='this.src=\"${srcPath}/common/images/mrbj.png\"'><\/img><\/td><td align='center' width='150px' style='vertical-align:middle;'>"+productMap[i].productFullName+"<\/td><td align='center' width='150px' style='vertical-align:middle;'>"+salesPrice+" 元"+"<\/td><td align='center' width='150px' style='vertical-align:middle;'>"+freightPrice+" 元"+"<\/td>"+
                            "<td align='center' width='150px' style='vertical-align:middle;'>"+zk+"<\/td><td align='center' width='150px' style='vertical-align:middle;'>"+virtualCoinNumber+" 个"+"<\/td><\/tr>";
                    }
                    $("#Order_Products").html(html);
                }
            });
        }else{
            $("#btn_orderProduct").attr("data-target","");
            showMsg("请选择一行记录！");
        }
    }
</script>
<div class="modal fade" id="view_Order_Products_Modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style="width:70%">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
				<h5 class="modal-title" id="myModalLabel">查看订单商品</h5>
			</div>
			<div class="modal-body">
				<table align="center" id="Order_Products" class="addOrEditTable table table-bordered" width="700px;" ></table>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
			</div>
		</div>
	</div>
</div>
